#!/bin/bash
# File Name: binlog.sh
# Author: moshan
# mail: mo_shan@yeah.net
# Created Time: 2019-04-11 15:16:38
# Function: 
#########################################################################
binlog_file="${1}"
log_dir="log"
[ ! -d "${log_dir}" ] && mkdir -p ${log_dir}
#begin_commit="${log_dir}/tmp.log"
begin_commit="/tmp/1"
#grep -En "BEGIN|COMMIT" ${binlog_file}|sed 's/[^A-Z0-9a-z:]//g' > ${begin_commit}
begin_row_array=($(grep BEGIN ${begin_commit}|awk -F: '{print $1}'))
commit_row_array=($(grep COMMIT ${begin_commit}|awk -F: '{print $1}'))
for (( i=0;i<${#begin_row_array[@]};i++))
do
	echo ${i}
	echo "${begin_row_array[${i}]}"
	echo "${commit_row_array[${i}]}"
	echo
done
